﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TugasAkhir.Models;
using TugasAkhir.Objects;

namespace TugasAkhir
{
    public partial class Mahasiswa : System.Web.UI.Page
    {
        MahasiswaObject mahasiswa; 

        protected void Page_Load(object sender, EventArgs e)
        {
            CheckSession();
        }

        private void CheckSession()
        {
            if (Session["id_role"] != null && Session["id_role"].ToString() == "RL01")
            {
                MahasiswaModel.GetMahasiswaDetail(Session["username"].ToString(), out this.mahasiswa);
                this.litName.Text = mahasiswa.Nama;
            }
            else
            {
                Response.Redirect("/Login.aspx");
            }
        }

        protected void lnkLogout_Click(object sender, EventArgs e)
        {
            Session["id_role"] = "";
            Session["username"] = "";
            CheckSession();
        }
    }
}